﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;

namespace WyoCode.WyoApp_VSTools
{
    class AppInfo
    {
        public static string GetStoreFolder()
        {

            //%LocalAppData%\Microsoft\VisualStudio\10.0\Extensions\<Company>\<Product>\<Version>

            
            var apppath = Environment.GetEnvironmentVariable("LocalAppData");

            Assembly execAssembly = Assembly.Load(Assembly.GetExecutingAssembly().FullName);
            AssemblyCompanyAttribute company = execAssembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true).FirstOrDefault() as AssemblyCompanyAttribute;
            AssemblyProductAttribute product = execAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), true).FirstOrDefault() as AssemblyProductAttribute;
            AssemblyFileVersionAttribute verson = execAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).FirstOrDefault() as AssemblyFileVersionAttribute;
            apppath = Path.Combine(apppath, @"Microsoft\VisualStudio\10.0\Extensions", company.Company, product.Product, verson.Version.Trim());
            return apppath;

        }

    }
}
